package com.wcy.serviceimpl;

import com.wcy.entity.Role;
import com.wcy.dao.RoleMapper;
import com.wcy.service.IRoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @since 2021-04-30
 */
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IRoleService {
    @Autowired
    private RoleMapper mapper;

    @Override
    public List<Role> getRoleList(String name) {
        return mapper.getRoleList(name);
    }

    @Override
    public int addRole(Role role) {
        return mapper.addRole(role);
    }

    @Override
    public int updateRole(Role role) {
        return mapper.updateRole(role);
    }

    @Override
    public Role getRoleById(int id) {
        return mapper.getRoleById(id);
    }

    @Override
    public int delRole(int id) {
        int i= mapper.delMenuRole(id);
        i +=  mapper.delRole(id);
        return i;
    }
}
